<?php
class person{
    public $name = 'Tom';
    public $gender = 1;
    static $money = 10000;
    //编写父类的构造方法
    public function __construct()
    {
        echo '这里是父类',PHP_EOL;
    }

    //父类的普通方法
    public function say(){
        echo $this->name,"\t is" , $this->gender, "\r\n";
    }
}

//子类继承父类
class family extends person{
    public $name;
    public $gender;
    public $age;
    static $money = 100000;
    //重写父类构造方法
    public function __construct()
    {
        //调用父类的构造方法
        // parent::__construct();
    }
    //说话,无论是大人还是小孩,都会说话,所以是可以进行重写  并且调用父类的方法
    public function say(){
        // parent::say();
        echo $this->name,"\t is \t",$this->gender,"and is \t",$this->age,PHP_EOL;
    }


    //但是小孩子有他自己特有的功能，哭
    public function cry(){
        echo parent::$money,PHP_EOL;
        echo '%<_>%',PHP_EOL;
        echo self::$money,PHP_EOL;//调用自身的过载方法
        echo '(*^ ^*)';
    }

}
$per = new person();
$per->name = 'Jerry';
$per->gender = 'man';
$poor = new family();
$poor->name = 'Lee';
$poor->gender = 'fmale';
$poor->age = 25;
// $poor->say();
// $per->say();
// $poor::cry();